//1.定义数组
var companys = new Array();
//2.定义数组中泛型的构造方法
function Company(name,img,href){
    this.name = name;
    this.img = img;
    this.href = href;
}
//4.拷贝静态模板，根据数组元素的个数克隆对象后，追加道指定元素中
$(document).ready(function(){
    initCompanys();
    var $companyTemplate = $(".companyPane > .companyInfo:eq(0)").clone();//克隆模板
    $(".companyPane").html("");//删除模板
    $(companys).each(function(i,company){
       var $newCompany =  $companyTemplate.clone();
       $newCompany.find("img").attr("src","../images/company/"+company.img).attr("alt",$(company.name).text());//将克隆出来的内容修改为当前公司信息
        $newCompany.children("a").attr("href",company.href);
        $newCompany.children("a").children(".cover").html(company.name);
        $(".companyPane").append($newCompany);
    });
});


//3.初始化数组 列出当前类型的全部枚举
function initCompanys(){
    companys.push(new Company("<div><div>慧科</div><div>教育科技集团</div></div>","huike.jpg","https://www.huike.com/index"));
    companys.push(new Company("<div><div>滨海讯腾</div><div>科技集团</div></div>","xunteng.jpg","http://www.xtgov.net/"));
    companys.push(new Company("<div>学堂在线</div>","xuetang.jpg","https://www.xuetangx.com/"));
    companys.push(new Company("<div>中国大学慕课</div>","mock.jpg","https://www.icourse163.org/"));
    companys.push(new Company("<div><div>四川</div><div>教育考试院</div></div>","jyks.png","https://www.sceea.cn/"));
    companys.push(new Company("<div><div>成都</div><div>人事考试网</div></div>","cdrs.png","http://cdpta.cdhrss.chengdu.gov.cn/netpage/index.do"));
}